package com.example.qa_back.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qa_back.entity.Admin;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author 董帅
 * @date 2021/3/6 - 11:27
 */
@Repository
public interface AdminMapper extends BaseMapper<Admin> {
    // 用来判断后台登录时输入的用户名是否存在
    @Select("SELECT id FROM admin WHERE name=#{name}")
    Integer getIdByName(@Param("name") String name);
    // 如果用户名存在再根据用户ID判断密码是否正确
    @Select("SELECT password FROM admin WHERE id=#{id}")
    String getPasswordById(@Param("id") Integer id);
}
